<template>
  <div>
    <h2>父组件</h2>
    <Child @from-child="handleFromChild"/>
    <p>接收到来自子组件的消息：{{ childMsg }}</p>
  </div>
</template>

<script>
import Child from './child.vue';

export default {
  components: {Child},
  data() {
    return {
      childMsg: ''
    };
  },
  methods: {
    handleFromChild(msg) {
      this.childMsg = msg;
    }
  }
};
</script>